<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>

        function Response(inputs) {
            let minResponsetime = Number.MAX_SAFE_INTEGER;
            let Responsetime = 0
            inputs = inputs.split('\n').map((value)=>{
                return value.trim()
            })
            
            let inputLen = inputs.length;
            
            let C = parseInt(inputs[0], 10);

            for (let i =1; i < inputLen; i++) {
                let time_new;
                let [T, M] = inputs[i].split(' ').map(Number);
                
                
                
                if (M < 128) {
                    time_new = M
                    
                } else {
                    const mant = M & 0b00001111;
                    const exp = (M & 0b01110000)>> 4 ;
                    time_new = (M & 0x10) << (exp + 3);

                    // console.log(M & 0x10);                    
                    console.log(time_new);
                    
                }
                

                minResponsetime = Math.min(minResponsetime, time_new+T);
                // console.log(i,minResponsetime);
                


            }
            return minResponsetime

        }

        const test1 = `3
        0 20
        1 10
        8 20`
        const test2 = `2
        0 255
        200 60`
        console.log(129&0x10);
        

        console.log(Response(test2));
        // console.log(Response(test2));

    </script>
</body>

</html>